package top.sssd.spi.dubbo.main;

import org.apache.dubbo.common.extension.ExtensionLoader;
import top.sssd.spi.dubbo.api.GreetingService;

public class Main {

    public static void main(String[] args) {
        // 通过 ExtensionLoader 动态加载 Algorithm 的实现类
        ExtensionLoader<GreetingService> loader = ExtensionLoader.getExtensionLoader(GreetingService.class);

        // 手动指定实现类
        GreetingService englishGreetingService = loader.getExtension("englishGreetingServiceImpl");
        System.out.println("englishGreetingService: " + englishGreetingService.getClass().getSimpleName());
        englishGreetingService.sayHello("sssd");

        GreetingService chineseGreetingService = loader.getExtension("chineseGreetingServiceImpl");
        System.out.println("chineseGreetingService: " + chineseGreetingService.getClass().getSimpleName());
        englishGreetingService.sayHello("sssd");

    }
}
